// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLReplaceable;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "SQLShowSessionStatement.h"
#include "../../visitor/SQLASTVisitor.h"

SQLExpr_ptr SQLShowSessionStatement::getLike()
{
  return like;
}

void SQLShowSessionStatement::setLike(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLShowSessionStatement));
  }
  this->like = x;
}

// @Override
void SQLShowSessionStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLShowSessionStatement)))
  {
    if (like != nullptr)
    {
      like->accept(visitor);
    }
  }
}

// @Override
BOOL_ptr SQLShowSessionStatement::replace(SQLExpr_ptr expr, SQLExpr_ptr target)
{
  if (like == expr)
  {
    setLike(target);
    return BOOL::TRUE;
  }

  return BOOL::FALSE;
}
